import request from '@/utils/request'

const baseApi = process.env.VUE_APP_BASE_API + '/auth'

// 登录
export function login(data) {
  return request({
    url: `${baseApi}/doLogin`,
    method: 'POST',
    data
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: baseApi + '/account/userInfo',
    method: 'POST'
  })
}

// 退出登录
export function logout() {
  return request({
    url: baseApi + '/account/doLogout?p=h5',
    method: 'POST'
  })
}

// 修改密码
export function changePsw({ username, oldPassword, newPassword }) {
  return request({
    url: `${baseApi}/account/changePwd`,
    method: 'POST',
    data: { username, oldPassword, newPassword }
  })
}
